// 流程节点管理接口
import { ajaxService } from '@/utils/request';
import * as typeObj from './type';

const env = import.meta.env;
const baseURL = env.VITE_BASE_URL;
/**
 *
 * @param data 添加流程节点
 * @returns
 */
export async function AddFlowPanelPoint(data: typeObj.FlowPanelPoint) {
  return ajaxService({
    url: '/flow/panel/point',
    method: 'post',
    baseURL,
    data
  });
}
/**
 * 获取流程节点列表
 * @param params
 * @returns
 */
export async function getFlowPanelPointList(params: {
  processId?: number;
  ownerType?: number;
}) {
  return ajaxService<{ panelPointList?: any }>({
    url: '/flow/panel/point/list',
    method: 'get',
    baseURL,
    params
  });
}
/**
 * 获取所有流程节点
 * @returns
 */
export async function getFlowPanelPointAll() {
  return ajaxService<any>({
    url: '/platform_ccc/FlowPanelPoint/all',
    method: 'get',
    baseURL
  });
}
/**
 * 获取单个流程节点的信息
 * @param id
 * @returns
 */
export async function getFlowPanelPointById(id: number) {
  return ajaxService<any>({
    url: `/flow/panel/point/${id}`,
    method: 'get',
    baseURL
  });
}
/**
 * 编辑流程节点
 * @param params
 * @returns
 */
export async function editFlowPanelPoint(data: typeObj.FlowPanelPoint) {
  return ajaxService({
    url: '/flow/panel/point',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * 删除流程节点
 * @param params
 * @returns
 */
export async function delFlowPanelPointByIds(data: { ids: number[] }) {
  return ajaxService({
    url: `/flow/panel/point`,
    method: 'delete',
    baseURL,
    data
  });
}
/**
 * 删除流程节点参与者
 * @param params
 * @returns
 */
export async function delFlowParticipantByIds(data: { ids: number[] }) {
  return ajaxService({
    url: `/flow/participant`,
    method: 'delete',
    baseURL,
    data
  });
}
/**
 * @param data 添加流程节点条件组
 * @returns
 */
export async function AddFlowConditionGroup(data: typeObj.ConditionGroup[]) {
  return ajaxService({
    url: '/flow/condition/group',
    method: 'post',
    baseURL,
    data
  });
}
/**
 * 获取流程节点条件组列表
 * @param params
 * @returns
 */
export async function getFlowConditionGroupList(params: { pointId: number }) {
  return ajaxService<{ list?: any }>({
    url: '/flow/condition/group/list',
    method: 'get',
    baseURL,
    params
  });
}
/**
 * 编辑流程节点条件组
 * @param params
 * @returns
 */
export async function editFlowConditionGroup(data: typeObj.ConditionGroup[]) {
  return ajaxService({
    url: '/flow/condition/group',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * 删除流程节点条件组
 * @param data
 * @returns
 */
export async function delFlowConditionGroupByIds(data: { ids: number[] }) {
  return ajaxService({
    url: `/flow/condition/group`,
    method: 'delete',
    baseURL,
    data
  });
}
/**
 * 删除流程节点条件项
 * @param data
 * @returns
 */
export async function delFlowConditionItemByIds(data: { ids: number[] }) {
  return ajaxService({
    url: `/flow/condition/items`,
    method: 'delete',
    baseURL,
    data
  });
}
// 获取人员花名册列表
export function GetHumanRosterList(params: any) {
  return ajaxService<any>({
    // url: '/pl/leave/page/roster',
    url: '/hr/personnel_matters/roster/personnel/list',
    method: 'get',
    baseURL: 'http://192.168.0.178:30058/',
    params
  });
}
